package LecoLi.Item03;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.demo.R;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;

import java.util.ArrayList;

import LecoLi.Util.Item03.LineChartManager;

import static android.R.attr.x;

/**
 * Created by Le Co on 2017/5/15.
 */

public class LineChartFragment extends Fragment {
    private LineChart LineChart;

    private View view;

    private LineChartManager lineChartManager;
    private Context context;
    private ArrayList<String> xValues;
    private ArrayList<Entry> yValue;
    private String CharName;
    private String LineName;
    public LineChartFragment(Context context,String CharName,String LineName, ArrayList<String> xValues,ArrayList<Entry> yValue){
         this.context = context;
         this.CharName=CharName;
         this.LineName = LineName;
         this.xValues=xValues;
         this.yValue = yValue;
    }




    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.leco_item_03_item, null);
        LineChart = $(R.id.leco_item_03_item_linechart);
        LineChart.setDescription(CharName);
        lineChartManager.setLineName(LineName);
        lineChartManager.initSingleLineChart(context,LineChart,xValues,yValue);
        return view;
    }


    public <T extends View> T $(int i) {

        return (T) view.findViewById(i);
    }
}
